/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package datasource;

import adc_lcard.ADCE140Driver;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author minaev
 */
public class ADCSource implements DataSource {

    int channel = 1;

    public ADCSource(int channel) {
        this.channel = channel;
        int i = 100;
        while (!ADCE140Driver.isInitADC() && --i != 0) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException ex) {
                Logger.getLogger(ADCSource.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        if(!ADCE140Driver.isInitADC()){
            ADCE140Driver.init();
            ADCE140Driver.setShitFiltering(false);
        }
    }

    @Override
    public double getData(double param,double param2) {
        return ADCE140Driver.getGdata(channel);
    }
}
